package com.snpic.appaw.module.insure.service.s3;

import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.model.PutObjectResult;
import com.snpic.appaw.module.insure.service.s3.bo.FileEntityBO;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import org.springframework.web.multipart.MultipartFile;

import java.awt.*;
import java.io.IOException;

/**
 * @author JiJun
 * @date 2025/9/13 13:29
 * @修改时间 2025/9/13 13:29
 * @description
 */
public interface AmazonS3ObjectService {

	/**
	 * 上传MultipartFile到S3
	 *  重载
	 * @param bucketName
	 * @param key
	 * @param multipartFile

	 * @return
	 * @throws IOException
	 */
	public PutObjectResult uploadMultipartFileToS3(String bucketName, String key, MultipartFile multipartFile) throws IOException, FontFormatException;

		/**
	 * 上传MultipartFile到S3
	 * 重载
	 * @param bucketName
	 * @param key           文件名字
	 * @param multipartFile
	 * @return
	 * @throws IOException
	 */
	public PutObjectResult uploadMultipartFileToS3(String bucketName, String key, @NotNull @Valid MultipartFile multipartFile,
																								 String waterMark, String colorstring) throws IOException, FontFormatException;

	/**
	 * 通过filePath方法,将本地文件夹文件,上传到对象存储
	 *
	 * @param bucketName
	 * @param key
	 * @param filePath
	 * @param s3client
	 * @return
	 */
	public PutObjectResult PutObject(String bucketName, String key, String filePath, AmazonS3 s3client);

	/**
	 * 先从url下载文件,再上传到S3
	 *
	 * @param file
	 * @param s3client
	 * @return
	 * @throws IOException
	 * @throws AmazonServiceException
	 */
	public PutObjectResult PutObjectRequest(FileEntityBO file, AmazonS3 s3client) throws IOException, AmazonServiceException;


	/**
	 * 将字符串内容转换为文件并上传到S3存储
	 *
	 * @param bucketName
	 * @param key        上传到S3的文件名称
	 * @param body       要上传的字符串内容
	 * @param s3client
	 * @return
	 * @throws IOException
	 */
	public PutObjectResult PutObjectRequestBody(String bucketName, String key, String body, AmazonS3 s3client) throws IOException;


	/**
	 * 单个删除文件
	 *
	 * @param bucketName
	 * @param Keys

	 */
	public void deleteObject(String bucketName, String Keys);

	/**
	 * 创建文件下载地址
	 *
	 * @param bucketName
	 * @param objectKey

	 * @return 文件下载地址url
	 * @throws IOException
	 */
	public String makeURL(String bucketName, String objectKey);

}
